Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deep-object-diff

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-object-diff

Deep diffs two objects, including nested structures of arrays and objects, and return the difference.

  • 1.1.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9M
decreased by-3.71%
Maintainers
1
Weekly downloads
 
Created

What is deep-object-diff?

The deep-object-diff npm package is designed to help developers identify differences between two JavaScript objects. It provides detailed insights into what has changed, including additions, deletions, and updates, making it particularly useful for tasks such as tracking state changes or debugging.

What are deep-object-diff's main functionalities?

Deep Diff

Calculates the deep difference between two objects, returning an object that represents the changes. In this example, it would output `{ b: 3 }`, indicating that the value of `b` has changed from `2` to `3`.

const { diff } = require('deep-object-diff');
const original = { a: 1, b: 2 };
const updated = { a: 1, b: 3 };
console.log(diff(original, updated));

Detailed Diff

Provides a detailed difference between two objects, categorizing the changes into added, deleted, and updated properties. The output for this example would be an object with `added`, `deleted`, and `updated` keys, showing that `b` was updated, `c` was added, and no keys were deleted.

const { detailedDiff } = require('deep-object-diff');
const original = { a: 1, b: 2 };
const updated = { a: 1, b: 3, c: 4 };
console.log(detailedDiff(original, updated));

Deleted Diff

Identifies properties that have been deleted from the original object. In this case, the output would be `{ c: 3 }`, indicating that `c` was present in the original object but is missing in the updated object.

const { deletedDiff } = require('deep-object-diff');
const original = { a: 1, b: 2, c: 3 };
const updated = { a: 1, b: 2 };
console.log(deletedDiff(original, updated));

Other packages similar to deep-object-diff

Keywords

FAQs

Package last updated on 12 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc